package org.leo.test.guava.eventbus.day1;

import com.google.common.eventbus.EventBus;
import lombok.extern.slf4j.Slf4j;

/**
 * <p>
 *
 * </p>
 *
 * @Package: org.leo.test.guava.eventbus.day1
 * @ClassName: DeadEventBusExample
 * @author: Li.Junlin
 * @date: 2019.12.16 11:43
 */
@Slf4j
public class DeadEventBusExample {
    public static void main(String[] args) {
        //重写EventBus的toString方法，使eventBus的名称为DEAD-EVENT-BUS
        final EventBus eventBus = new EventBus() {
            @Override
            public String toString() {
                return "DEAD-EVENT-BUS";
            }
        };
        DeadEventListener deadEventListener = new DeadEventListener();
        eventBus.register(deadEventListener);
        eventBus.post(1111);
        eventBus.post("DeadEventListener event");

    }
}
